﻿<Controls:SinacorWindow    
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"  
    xmlns:Custom="http://schemas.xceed.com/wpf/xaml/datagrid"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d"
    xmlns:Model="clr-namespace:Sinacor.UI.Bovespa.Corretagem.Model;assembly=Sinacor.UI.Bovespa.Corretagem.Model"
    xmlns:Controls="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient;assembly=Sinacor.Infra.UI.Controls"
    xmlns:Validation="clr-namespace:Sinacor.Infra.UI.Controls.SmartClient.Validation;assembly=Sinacor.Infra.UI.Controls"
    WindowStartupLocation="CenterScreen"
    WindowState="Normal"
    Height="550"
    Width="730"
    Title="{DynamicResource Bovespa.Corretagem.Label.CadastroTiposComissao}"
    x:Class="Sinacor.UI.Bovespa.Corretagem.View.SmartClient.CadastroTiposComissao"
    ModulePlus="False"
    ModuleId="ORD">

    <Controls:SinacorExpanderContainer>

        <Controls:SinacorExpander Header="{DynamicResource Bovespa.Corretagem.Label.TiposComissao}"
                                  IsExpanded="True"
                                  AllowExpand="False">
            <Grid>
                <Controls:SinacorDataGrid x:Name="dtgTipoComissao"
                                          IsSynchronizedWithCurrentItem="True"
                                          RowEditMode="AllCells"
                                          ItemsSource="{Binding ListaFaixaComissoes}"
                                          AllowDelete="True"
                                          Deleting="dtgTipoComissao_Deleting"
                                          EndingInsert="dtgTipoComissao_EndingInsert"
                                          EndingUpdate="dtgTipoComissao_EndingUpdate"
                                          CurrentCellChanged="dtgTipoComissao_CurrentCellChanged"
                                          CancelingInsert="dtgTipoComissao_CancelingInsert"
                                          CancelingUpdate="dtgTipoComissao_CancelingUpdate"
                                          InsertEnded="dtgTipoComissao_InsertEnded"
                                          UpdateEnded="dtgTipoComissao_UpdateEnded">
                    <Controls:SinacorDataGrid.Columns>

                        <Controls:Column Name="NumeroFaixa"								 				
                                         Title="Bovespa.Corretagem.Label.NumFaixa"
                                         DisplayMemberPath="NumeroFaixa"
                                         HorizontalCellAlignment="Right"
                                         IsRequired="True" 
                                         AllowInsert="False"  
                                         AllowUpdate="False">
                            <Controls:Column.CellInsertTemplate>
                                <DataTemplate>
                                    <Controls:SinacorInt32TextBox x:Name="txtNumeroFaixa" 
                                                                  IsFormated="False" 
                                                                  Integers="3" 
                                                                  MinValue="1"
                                                                  MaxValue="999"
                                                                  AcceptsNegative="False"                                                                  
                                                                  IsRequired="False"
                                                                  Value="{Binding NumeroFaixa}"
                                                                  RequiredErrorMessage="Bovespa.Corretagem.ExceptionMessage.NumeroFaixaNaoInformado">
                                        <Controls:SinacorInt32TextBox.ValidationRules>
                                            <Validation:EventValidationRule Validating="ValidaNumeroFaixa_Validating"/>
                                        </Controls:SinacorInt32TextBox.ValidationRules>
                                    </Controls:SinacorInt32TextBox>
                                </DataTemplate>
                            </Controls:Column.CellInsertTemplate>
                        </Controls:Column>

                        <Controls:Column Name="Percentual"									 				
                                         Title="Bovespa.Corretagem.Label.Percentual"
                                         DisplayMemberPath="Percentual"
                                         HorizontalCellAlignment="Right"
                                         IsRequired="True" 
                                         AllowInsert="True"  
                                         AllowUpdate="True"				
                                         CellUpdateTemplate="{Binding Path=CellInsertTemplate, RelativeSource={RelativeSource Self}}"
                                         StringFormat="N3">

                            <Controls:Column.CellInsertTemplate>
                                <DataTemplate>
                                    <Controls:SinacorDecimalTextBox x:Name="txtPercentual" 
                                                                    IsFormated="True" 
                                                                    Integers="3"
                                                                    Decimals="3"
                                                                    IsRequired="True"
                                                                    Value="{Binding Percentual}"
                                                                    RequiredErrorMessage="Bovespa.Corretagem.ExceptionMessage.AliquotaFaixaComissaoNaoInformada"/>
                                </DataTemplate>
                            </Controls:Column.CellInsertTemplate>
                        </Controls:Column>

                        <Controls:Column Name="ValorInferior" 									 				
                                         Title="Bovespa.Corretagem.Label.ValorInferior"
                                         DisplayMemberPath="ValorInferior"
                                         HorizontalCellAlignment="Right"
                                         IsRequired="True" 
                                         AllowInsert="True"  
                                         AllowUpdate="True"									 				
                                         CellUpdateTemplate="{Binding Path=CellInsertTemplate, RelativeSource={RelativeSource Self}}"
                                         StringFormat="N2"
                                         AutoAdjustWidthToContent="False"
                                         Width="150">

                            <Controls:Column.CellInsertTemplate>
                                <DataTemplate>
                                    <Controls:SinacorDecimalTextBox x:Name="txtValorInferior" 
                                                                    IsFormated="True" 
                                                                    Integers="17"
                                                                    Decimals="2"
                                                                    IsRequired="True"
                                                                    Value="{Binding ValorInferior}"
                                                                    RequiredErrorMessage="Bovespa.Corretagem.ExceptionMessage.ValorInferiorNaoInformado"/>
                                </DataTemplate>
                            </Controls:Column.CellInsertTemplate>
                        </Controls:Column>

                        <Controls:Column Name="ValorSuperior"									 				
                                         Title="Bovespa.Corretagem.Label.ValorSuperior"	
                                         DisplayMemberPath="ValorSuperior"
                                         HorizontalCellAlignment="Right"
                                         IsRequired="True" 
                                         AllowInsert="True"  
                                         AllowUpdate="True"				
                                         CellUpdateTemplate="{Binding Path=CellInsertTemplate, RelativeSource={RelativeSource Self}}"
                                         StringFormat="N2"
                                         AutoAdjustWidthToContent="False"
                                         Width="150">

                            <Controls:Column.CellInsertTemplate>
                                <DataTemplate>
                                    <Controls:SinacorDecimalTextBox x:Name="txtValorSuperior" 
                                                                    IsFormated="True" 
                                                                    Integers="17"
                                                                    Decimals="2"
                                                                    IsRequired="True"
                                                                    Value="{Binding ValorSuperior}"
                                                                    RequiredErrorMessage="Bovespa.Corretagem.ExceptionMessage.ValorSuperiorNaoInformado"/>
                                </DataTemplate>
                            </Controls:Column.CellInsertTemplate>
                        </Controls:Column>

                    </Controls:SinacorDataGrid.Columns>
                </Controls:SinacorDataGrid>
            </Grid>
        </Controls:SinacorExpander>
    </Controls:SinacorExpanderContainer>

</Controls:SinacorWindow>